package com.yue.springDemo.business.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yue.springDemo.business.bean.User;
import com.yue.springDemo.business.mapper.HelloMapper;
import com.yue.springDemo.business.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class HelloServiceImpl implements HelloService {

    @Autowired
    private HelloMapper helloMapper;

    @Override
    public List<User> findAll() {
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        return helloMapper.selectList(wrapper);
    }

    @Override
    public User findById(String id) {
        return helloMapper.selectById(id);
    }

    @Override
    public void saveUser() {
        User user = new User();
        user.setName("lalala3");
        user.setAge(30);
        user.setAddress("山东开发工具哦i违法");
        user.setCreateTime(new Date());
        helloMapper.insert(user);
    }
}
